package com.zyf.recruit.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zyf.recruit.dao.EnterpriseDao;
import com.zyf.recruit.pojo.Enterprise;
import com.zyf.recruit.service.EnterpriseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@CacheConfig(cacheNames = "enterprise_")
public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseDao, Enterprise> implements EnterpriseService {
    @Autowired
    EnterpriseDao enterpriseDao;

    //需求：查询企业表ishot字段为id的记录
    @Cacheable(key = "#id")
    public List getIsHot(String id) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("ishot", id);
        return enterpriseDao.selectList(queryWrapper);
    }

}
